package sanrenxing.ForePaper.servlet;

import java.util.*;
import java.util.Collections;
import java.util.Random;

/**
 * @author Administrator
 * @date 2020/10/6 0:08
 * 编辑者：邓志强
 * 功能：
 */
public class Test {
    public static void main(String[] args) {
        /*char[] c={'A','B','C','D'};
        System.out.println(c[2]);*/

        /*int[] a = new int[4];//初始化数组---------随机数
        Random random = new Random();
        int count = 0;//记录有效的随机数个数
        while(count <= a.length){
            boolean flag = true;//用来标志的变量
            int r = random.nextInt(4)+1;
            for(int i=0;i<a.length;i++){
                if(r == a[i]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                a[count] = r;
                System.out.println(r-1);
                count++;
            }
        }*/


        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < 10; i++)
            list.add(new Integer(i));
        System.out.println("打乱前:");
        System.out.println(list);

        for (int i = 1; i < 6; i++) {
            System.out.println("第" + i + "次打乱：");
            Collections.shuffle(list);
            System.out.println(list);
        }

        int[] a=new int[4];
        a[0]=1;
        System.out.println(a[0]);
    }
}
